package client;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

import javax.swing.JOptionPane;

public class Util {
	public static byte[] fileToByteArray(File f){
		InputStream in = null;
		byte[] returnByte = null;
		
		try{
			in = new FileInputStream(f);
			returnByte = new byte[(int)f.length()];
			int offset = 0;
			
			while(offset < f.length()){
				returnByte[offset] = (byte)in.read();
				offset++;
			}
			
			in.close();
		}catch (Exception e){
			e.printStackTrace();
		}
		return returnByte;
	}
}
